<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets">
    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Cadastro de Pescador | Eletronorte</title>
        <h:outputStylesheet library="css" name="style.css" />
        <link rel="icon" href="#{request.contextPath}/_img/favicon.ico" type="image/ico" />
    </h:head>

    <h:body>
        <div id="interface">
            <table id="table-header" cellpadding="0" cellspacing="0">
                <!-- TOPO -->
                <tr>
                    <td><ui:include src="/pages/template/header.xhtml" /></td>
                </tr>

                <!--  MENU -->
                <tr>
                    <td><ui:include src="/pages/protected/admin/menu.xhtml" /></td>
                </tr>
            </table>

            <h1>CADASTRO DE PESCADOR</h1>
            <h2>
                <font class="campoObrigatorio">* Campo Obrigatório!</font>
            </h2>

            <h:form id="form1" enctype="multipart/form-data" style="margin:0px 29px 10px 29px">

                <p:growl id="campoObrigatorio" life="4000" showDetail="false"
                         rendered="#{facesContext.validationFailed == true}" />                
                <p:growl for="sucesso" id="sucesso" life="4000" showDetail="true" />                
                <p:growl for="atencao" id="atencao" life="4000" showDetail="true" />

                <p:panelGrid style="width:100%">
                    <p:row>
                        <p:column style="width: 30%;text-align:right">
                            <h:outputLabel for="nome" value="Nome: *" />
                        </p:column>
                        <p:column style="text-align:left">
                            <p:inputText id="nome" label="Nome" size="65" value="#{pescadorBean.pescador.nome}" required="true" requiredMessage="Campo Nome obrigatório!"/>
                        </p:column>
                    </p:row>
                    <p:row>
                        <p:column style="text-align:right">
                            <h:outputLabel for="telefone" value="Telefone: *" />
                        </p:column>
                        <p:column style="text-align:left">
                            <p:inputMask id="telefone" value="#{pescadorBean.pescador.telefone}"
                                         size="18" mask="(99) 99999-9999" required="true" requiredMessage="Campo Telefone obrigatório!">
                                <f:validateLength minimum="1" />
                            </p:inputMask>
                        </p:column>
                    </p:row>
                    <p:row>
                        <p:column colspan="2" style="text-align: center">
                            <p:commandButton value="Salvar" icon="ui-icon-check" ajax="false" 
                                             style="margin: 2px 0px 2px 0px"
                                             action="#{pescadorBean.criarPescador()}" update="sucesso campoObrigatorio atencao" />
                        </p:column>
                    </p:row>
                </p:panelGrid>
            </h:form>

            <!-- RODAPE -->
            <table id="table-footer">
                <ui:include src="/pages/template/footer.xhtml" />
            </table>
        </div>
    </h:body>
</html>